Skip to content

An implementation of Euclidean Algorithm in D #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2019

Conversation

ADedecker
Copy link

No description provided.

@june128 june128 added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Mar 18, 2019
@leios
Copy link
Member

leios commented Mar 18, 2019

Thanks for the implementation! I don't really know D too well, but would it be alright to review the code from the perspective of C?

@c252
Copy link
Member

c252 commented Mar 18, 2019

The main algorithm seems to be just like the C code. Everything seems correct according to the D style guide https://dlang.org/dstyle.html

auto check1 = euclid_mod(64 * 67, 64 * 81);
auto check2 = euclid_sub(128 * 12, 128 * 77);

writeln(check1,'\n',check2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I would add (to keep it consistent with Leios's Julia code) would be to
have the print statements say:
writeln("Modulus-based euclidean algorithm result: ", check1);
writeln("Subtraction-based euclidean algorithm result: ", check2);

Copy link
Member

@c252 c252 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Member

@leios leios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @c252 !

@leios leios merged commit 14b9cde into algorithm-archivists:master Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants